using System.Windows.Input;

namespace Bookvar.UI.Commands
{
    public abstract class CommandModel
    {
        private readonly ICommand command;

        public ICommand Command
        {
            get { return command; }
        }

        public virtual InputGesture InputGesture
        {
            get
            {
                return CommandGestures.GetGestureForCommand( command );
            }
        }

        public bool HasInputGesture
        {
            get
            {
                return InputGesture != null;
            }
        }

        protected CommandModel( ICommand command )
        {
            this.command = command;
        }

        protected internal virtual void OnCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
            e.Handled = true;
        }

        protected internal abstract void OnExecute(object sender, ExecutedRoutedEventArgs e);
    }
}